Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes across multiple files to enhance the functionality and performance of the SimpleCDN project. The most important changes focus on adding benchmarking for
StringBuilder
conversions, simplifying the Redis cache service, and introducing new helper methods.Benchmarking and Performance Improvements:
benchmarks/StringBuilderConversionBenchmarks.cs
: Added a new benchmarking classStringBuilderConversionBenchmarks
to compare the performance of manual and built-inStringBuilder
to byte array conversions.src/core/Helpers/StringBuilderExtensions.cs
: Introduced an extension methodToByteArray
forStringBuilder
to efficiently convert its contents to a byte array without creating a string copy.Redis Cache Service Simplification:
extensions/Redis/CustomRedisCacheService.cs
: Simplified theCustomRedisCacheService
by removing theObjectAccessBalancer
and directly using a singleConnectionMultiplexer
instance. This change also updated methods to handle Redis operations more efficiently.extensions/Redis/ObjectAccessBalancer.cs
: Removed theObjectAccessBalancer
class as it is no longer needed for managing Redis connections.Configuration and Logging Enhancements:
extensions/Redis/RedisCacheConfiguration.cs
: Updated the defaultKeyPrefix
to "SimpleCDN::" for better key namespace management in Redis.src/core/Services/Caching/Implementations/CacheManager.cs
: Changed logging level fromLogDebug
toLogInformation
for cache misses to provide better visibility in logs.Miscellaneous Improvements:
src/core/Helpers/InternalExtensions.cs
: Reworked theForLog
method to handleReadOnlySpan<char>
more efficiently using aStringBuilder
.src/core/Services/Caching/Implementations/InMemoryCache.cs
: Added aClear
method to theInMemoryCache
class for clearing all cached items.These changes collectively improve the performance, maintainability, and functionality of the SimpleCDN project.